package com.gcs.demo.controller;

import com.gcs.demo.annotation.CheckRequireParam;
import com.gcs.demo.pojo.UserInfo;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestDemoController {

    @GetMapping("/test")
    @CheckRequireParam(requireParam = {"username","age"})
    public String testRequireParam(UserInfo info){
        return info.getUsername();
    }

    @GetMapping("/test1")
    public String test(@RequestParam HashMap<String,String> map){
        return map.get("username");
    }

    @PostMapping("/postTest")
    @CheckRequireParam(requireParam = {"password"})
    public UserInfo postTest(@RequestBody UserInfo userInfo){
        return userInfo;
    }
}
